package com.ljfiction.book.activitys;

import android.graphics.Bitmap;
import android.os.Bundle;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.ScrollView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.request.animation.GlideAnimation;
import com.bumptech.glide.request.target.SimpleTarget;
import com.ljfiction.book.R;
import com.ljfiction.book.tools.AppUtils;
import com.ljfiction.book.tools.ScreenUtils;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class AnnouncementallActivity extends BaseActivity {

    @BindView(R.id.image_gonggaoall)
    ImageView imageGonggaoall;
    @BindView(R.id.back_gonggaoall)
    ImageView backGonggaoall;
    @BindView(R.id.scrollview_gonggao)
    ScrollView scrollviewGonggao;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_announcementall);
        ButterKnife.bind(this);
        AppUtils.init(this);
        Glide.with(this)
                .load(getIntent().getStringExtra("maximage"))
                .asBitmap()
                .into(new SimpleTarget<Bitmap>() {
                    @Override
                    public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) {
                        ViewGroup.LayoutParams lp = imageGonggaoall.getLayoutParams();
                        lp.height = (int) (ScreenUtils.getScreenWidth() *((float)resource.getHeight() / resource.getWidth()));
                        imageGonggaoall.setLayoutParams(lp);
                        imageGonggaoall.setImageBitmap(resource);
                    }
                });
    }

    @OnClick(R.id.back_gonggaoall)
    public void onViewClicked() {
        goBack();
    }
}
